package com.ruoyi.web.controller.yijing;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.yijing.domain.YjFamous;
import com.ruoyi.yijing.service.IYjFamousService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 易经名家Controller
 * 
 * @author ruoyi
 * @date 2024-01-22
 */
@RestController
@RequestMapping("/yijing/famous")
public class YjFamousController extends BaseController
{
    @Autowired
    private IYjFamousService yjFamousService;

    /**
     * 查询易经名家列表
     */
    //@PreAuthorize("@ss.hasPermi('yijing:famous:list')")
    @GetMapping("/list")
    public TableDataInfo list(YjFamous yjFamous)
    {
        startPage();
        List<YjFamous> list = yjFamousService.selectYjFamousList(yjFamous);
        return getDataTable(list);
    }


    /**
     * 获取易经名家详细信息
     */
    //@PreAuthorize("@ss.hasPermi('yijing:famous:query')")
    @GetMapping(value = "/{famousId}")
    public AjaxResult getInfo(@PathVariable("famousId") Long famousId)
    {
        return success(yjFamousService.selectYjFamousByFamousId(famousId));
    }

    /**
     * 新增易经名家
     */
    //@PreAuthorize("@ss.hasPermi('yijing:famous:add')")
    @Log(title = "易经名家", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YjFamous yjFamous)
    {
        return toAjax(yjFamousService.insertYjFamous(yjFamous));
    }

    /**
     * 修改易经名家
     */
    //@PreAuthorize("@ss.hasPermi('yijing:famous:edit')")
    @Log(title = "易经名家", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YjFamous yjFamous)
    {
        return toAjax(yjFamousService.updateYjFamous(yjFamous));
    }

    /**
     * 删除易经名家
     */
    //@PreAuthorize("@ss.hasPermi('yijing:famous:remove')")
    @Log(title = "易经名家", businessType = BusinessType.DELETE)
	@DeleteMapping("/{famousIds}")
    public AjaxResult remove(@PathVariable Long[] famousIds)
    {
        return toAjax(yjFamousService.deleteYjFamousByFamousIds(famousIds));
    }
}
